package com.sinoglobal.wallet.receiver;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Message;
import android.support.v4.app.Fragment;

import com.sinoglobal.wallet.fragment.W_HomeFragment;
import com.sinoglobal.wallet.activity.W_MyBankActivity;
import com.sinoglobal.wallet.activity.W_SinoBaseActivity;
import com.sinoglobal.wallet.app.SinoConstans;

/**
 * clf  提现成功后更改主页面的余额值。以及设置密码成功后发广播隐藏设置密码的布局
 */
public class W_ChangeFragmentBalanceReciver extends BroadcastReceiver{
    public Context Context;
    Fragment fragment ;
    public W_ChangeFragmentBalanceReciver(Context context) {
    	this.Context = context;
    	 fragment = ((W_SinoBaseActivity) context).getFragmentByTag("frag");
    }

    @Override
    public void onReceive(Context context, Intent intent) {
        if(intent.getAction().equals(SinoConstans.KEY_BalanceReceiver)){
        	
            String Balance = intent.getStringExtra("Balance");//提现成功传来的数据
            boolean hidePassWord = intent.getBooleanExtra("hidePassWord", false);//设置密码成功后传来的数据 
            String bankCardNum = intent.getStringExtra("bankCardNum");//设置银行卡列数
            if(Balance!=null){
            	((W_HomeFragment)fragment).setBalance(Balance);
            }
            if(hidePassWord){
            	((W_HomeFragment)fragment).setisHasdPass(hidePassWord);
            }
            	if(bankCardNum!=null){
            		((W_HomeFragment)fragment).setBankCardNum(bankCardNum);
            }
        }

    }
}
